<?php
//TODO remove that, refactor into Topic controller, or main refactor to the link back
use core\user\UserRoles;
$vars['helper']->insertMessage();

$vars['helper']->addCssFile('topics_loop.css');
// to remove the container css class
$vars['helper']->setContainerClass('');

$pagination = $vars['pagination'];
$topicTemplate = $vars['topicTemplate'];
$topic = $vars['topic'];
$forumId = $vars['forumId'];
$postsTemplate = $vars['postsTemplate'];
$posts = $vars['posts'];
$commentForm = $vars['commentForm'];

$vars['helper']->setTitle(__('Topic'));
$displayDeletedLink = $vars['displayDeletedLink'];
?>

<div id="link-back">
<a class="button" 
	href="<?php echo $vars['helper']->createHref('Home')?>">
		<?php echo __('Home'); ?>
</a>
<?php if($vars['helper']->currentUserIsAtLeast(UserRoles::$full_user_role)): ?>
<a class="button" 
	href="<?php $vars['helper']->insertHref( 'Forum', 'displaySingleForum', array('forumId'=>$forumId )); ?>">
		<?php echo __('Discussions'); ?>
</a>
<?php endif;?>
&nbsp;
<h4> 
<?php echo __('Topic'); ?></h4>

<?php if($displayDeletedLink):?>
	<div id="link-back-right">
		<?php if($vars['isDisplayDeleted']): ?>
			<a class="button" href="<?php echo $displayDeletedLink ?>"><?php echo __('Display deleted items'); ?></a>
		<?php else: ?>
			<a class="button" href="<?php echo $displayDeletedLink ?>"><?php echo __('Hide deleted items'); ?></a>
		<?php endif; ?>
	</div>
<?php endif; ?>
</div>

<!-- Link to the parent forum -->
<!-- title / content -->
<?php $topicTemplate->insert(); ?>
<!-- 1st pagination -->
<?php $pagination->insert(); ?>
<!-- posts -->
<?php $postsTemplate->insert(); ?>
<!-- 2nd pagination -->
<?php $pagination->insert(); ?>
<!-- form to comment -->
<?php $commentForm->insert(); ?>
